
#! /bin/bash
HIVE_HOME=/usr/bin/hive


${HIVE_HOME} -S -e "create database if not exists oe_dws;
use oe_dws;

drop table if exists dws_attendance_daycount;
create table if not exists dws_attendance_daycount
(
    date_code                  date comment '日期',
    class_id                   int comment '班级id',
    content                    string comment '上课内容',
    studying_student_count     int comment '在读人数',
    morning_attendance_count   bigint comment '上午出勤人数',
    morning_attendance_ratio   decimal(22,2) comment '上午出勤率',
    morning_late_count         bigint comment '上午迟到人数',
    morning_late_ratio         decimal(22,2) comment '上午迟到率',
    afternoon_attendance_count bigint comment '下午出勤人数',
    afternoon_attendance_ratio decimal(22,2) comment '下午出勤率',
    afternoon_late_count       bigint comment '下午迟到人数',
    afternoon_late_ratio       decimal(22,2) comment '下午迟到率',
    evening_attendance_count   bigint comment '晚上出勤人数',
    evening_attendance_ratio   decimal(22,2) comment '晚上出勤率',
    evening_late_count         bigint comment '晚上迟到人数',
    evening_late_ratio         decimal(22,2) comment '晚上迟到率'
) COMMENT '出勤情况表'
    row format delimited
        fields terminated by '\t'
    stored as orc
    tblproperties ('orc.compress' = 'SNAPPY');

drop table if exists dws_leave_daycount;
create table if not exists dws_leave_daycount
(
    date_code              date comment '日期',
    class_id               int comment '班级id',
    content                string comment '上课内容',
    studying_student_count int comment '在读人数',
    morning_leave_count    bigint comment '上午请假人数',
    morning_leave_ratio    decimal(22,2) comment '上午请假率',
    afternoon_leave_count  bigint comment '下午请假人数',
    afternoon_leave_ratio  decimal(22,2) comment '下午请假率',
    evening_leave_count    bigint comment '晚上请假人数',
    evening_leave_ratio    decimal(22,2) comment '晚上请假率'
) COMMENT '请假情况表'
    row format delimited
        fields terminated by '\t'
    stored as orc
    tblproperties ('orc.compress' = 'SNAPPY');"





